/**
 * 统计输入数据中不同长度单词的数量，并用柱状图输出统计结果
 */

#include <stdio.h>

#define IN 1
#define OUT 0
#define MAX 26

int main() {
    int c, i, j, state, length, nwords[MAX];

    for( i = 0; i < MAX; i++) nwords[i] = 0;

    state = OUT;
    length = 0;
    while ((c = getchar()) != EOF) {
        if (c == ' ' || c == '\t' || c == '\n') {
            if (length > MAX) {
                printf("Error! word length has exceeding!\nword length: %d,\
                        MAX: %d\n", length, MAX);
                return -1;
            }
            if (length > 0) {
                nwords[length-1]++;
                length = 0;
            }
            state = OUT;

        } else if (state == OUT) {
            state = IN;
        }

        if ( state == IN) {
            length++;
        }
    }

    for(i = 0; i < MAX; i++) {
        if (nwords[i]) {
            printf("%2d : ", i+1);
            for (j = 0; j < nwords[i]; j++) putchar('*');
            putchar('\n');
        }
    }

    return 0;

}
